package com.qying.code;

import java.util.ArrayList;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.ThreadPoolExecutor;

public class ThreadTest {

    public static void main(String[] args) throws InterruptedException {
//        CountDownLatch countDownLatch = new CountDownLatch(1);
//        ExecutorService executorService = Executors.newSingleThreadExecutor();
//        MyRunnable myRunnable = new MyRunnable(countDownLatch);
//
//        executorService.execute(myRunnable);
//        countDownLatch.await();
//        System.out.println("++++++++++++++++++++++");

        ArrayList<Integer> integers = new ArrayList<>();
        integers.add(1);
        System.out.println(integers.size());
    }
}

class MyRunnable implements Runnable {

    private CountDownLatch countDownLatch;

    public MyRunnable(CountDownLatch countDownLatch) {
        this.countDownLatch = countDownLatch;
    }

    @Override
    public void run() {
        System.out.println("---------------");
        countDownLatch.countDown();
    }
}
